import Pageable from "@/utils/Pageable";
import { Request } from "@/utils/http";
import { ServerResponse } from "@/utils/serverResponse";

interface addParams {
    id?: string,
    name: string
}

interface queryParams {
    data: {
        name?: string
    },
    current: number,
    pageSize: number
}

interface listItem {

}

interface listVo extends Pageable {
    data: listItem[]
}

export default class TypeApi {

    // 获取计划列表
    public async typeList(params: queryParams): Promise<listVo | undefined> {
        const res: ServerResponse<listVo> = await Request.post('/api/incAndExp/type/list', params)
        return res.data
    }

    // 添加日计划
    public async addType(params: addParams): Promise<any> {
        const res: ServerResponse<number> = await Request.post('/api/incAndExp/type/add', params)
        return res.data
    }

    //编辑日计划
    public async editType(params: addParams): Promise<any> {
        const res: ServerResponse<number> = await Request.post('/api/incAndExp/type/edit', params)
        return res.data
    }

    // 删除计划
    public async deleteType(id: string): Promise<any> {
        const res: ServerResponse<number> = await Request.get('/api/incAndExp/type/delete?id=' + id)
        return res.data
    }
}